package com.itheima.myvariableparameter;

import java.util.ArrayList;
import java.util.Collections;

public class Demo1 {
    public static void main(String[] args) {
        int sum1 = getSum(1, 2, 3, 4, 5);
        System.out.println(sum1);

        ArrayList<String> list = new ArrayList<>();
        String[] arr = {"hello","world","java"};
        Collections.addAll(list,arr);
        Collections.addAll(list,"hello","world","java");
        System.out.println(list);
    }

    public static int getSum(int number,int...arr) {
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        return sum;
    }
}
